/*
 * @Description: 你的代码我的心
 * @Author: GGB
 * @Date: 2021-12-29 18:27:10
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-22 16:12:23
 */
import { Tag } from 'ant-design-vue';
// import { h } from 'vue';
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';

// table表格 数据
export const columns: BasicColumn[] = [
  {
    title: '核销码',
    dataIndex: 'verify_code',
  },
  {
    title: '核销类型',
    dataIndex: 'verify_type_name',
  },
  {
    title: '核销员',
    dataIndex: 'verifier_name',
  },
  {
    title: '状态',
    dataIndex: 'is_verify',
    slots: { title: 'customStatus', customRender: 'Status' },
    customRender: ({ text }) => {
      const color = text === 1 ? 'green' : 'red';
      const content = text === 1 ? '已核销' : '未核销';
      return <Tag color={color}>{content}</Tag>;
      // return h(
      //   Tag,
      //   {
      //     color,
      //   },
      //   () => content,
      // );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'create_time',
  },
  {
    title: '核销时间',
    dataIndex: 'update_time',
  },
];

// 表格搜索框
export const searchFormSchema: FormSchema[] = [
  {
    field: 'search',
    label: '核销员名称',
    component: 'Input',
    labelWidth: 80,
    colProps: { span: 5 },
  },
  {
    field: 'betweenTime',
    label: '核销时间',
    component: 'RangePicker',
    componentProps: {
      dateFormatList: ['DD-MM-YYYY', 'DD-MM-YY'],
      valueFormat: 'DD-MM-YYYY',
    },
    labelWidth: 80,
    colProps: { span: 7 },
  },
  {
    field: 'verify_code',
    label: '核销码',
    component: 'Input',
    labelWidth: 80,
    colProps: { span: 5 }
  },
];
